{extend name="./oscshop/admin/view/public/base.html" /}
{block name="content"}
<div class="page-header">
		<h1>
			{$breadcrumb2}
			<small>
				<i class="ace-icon fa fa-angle-double-right"></i>
				{$crumbs}
			</small>
		</h1>
</div>	
	<ul class="nav nav-tabs">
	
	</ul>

	<form class="form-horizontal" id="validation-form"  method="post" action='{:url("exception/init_state")}'>	
	<div class="tab-content">			
		<div class="tab-pane active" id="tab-member">
			<table class="table table-binfoed">
				<tr>
				    <td>ID</td>
				    <td>{$data.info.id}</td>
				    <input type="hidden" name="id" value="{$data.info.id}" />
				</tr>
				<tr>
				    <td>手机号码</td>
				    <td>{$data.info.username}</td>


				</tr>
				<tr>
				    <td>姓名</td>
				    <td>{$data.info.id_name}</td>


				</tr>
				<tr>
				    <td>身份证号</td>
				    <td>{$data.info.id_card}</td>


				</tr>

				<tr>
				    <td>交易所账号</td>
				    <td>{$data.info.trade_id}</td>


				</tr>	
				<tr>
				    <td>交易所副账号</td>
				    <td>{$data.info.sub_trade_id}</td>


				</tr>											
				<tr>
					<td>交易所</td>
					<td>
						<select name="exchange_id" id ="exchange_id"  style="width:400px;" >
			                  <option value ="-1">--请选择交易所--</option> 
			                  {volist name="exchange" id="p" empty="$exchange"}
			                  <option value ="{$p.id}" {if condition="$p.id eq $data.info.exchange_id"}selected{/if}>{$p.name}</option>              
			                  {/volist}  
            			</select> 
            		</td>
				</tr>
				<tr>
					<td>交易品种</td>
					<td>
					<select name="variety_id" id ="variety_id"  style="width:400px;" tabindex="4">
	                  <option value ="-1">--请选择交易品种--</option> 
	                  {volist name="variety" id="p" empty="$variety"}
	                   
	                  {if condition="$p.id eq $data.info.exchange_variety_id"}
	                 	<option value ="{$p.id}" selected>{$p.name}</option> 
	                 {/if}            
	                  {/volist}  
	                  </td>
					<td>
            		</select> 
				</tr>
				<tr>
				    <td>交易品种ID</td>
				    <td>{$data.info.variety_id}</td>
				    
				</tr>
				<tr>
				    <td>当前轮次</td>
				    <td>第{$data.info.rang-1}轮</td>
				    <input type="hidden" readonly="true" name="rang" id="rang" value="{$data.info.rang}">
				</tr>
								<tr>
				    <td>买入价格</td>
				    <td><input name="buy_price"  id="buy_price" type="text" style="width:400px;" value="" /></td>
				    
				</tr>
				<tr>
				    <td>买入数量</td>
				    <td><input name="buy_num"  id="buy_num" type="text" style="width:400px;" value="" /></td>
				    
				</tr>


				<tr>
				    <td>买入时间</td>
				    <td><input name="buy_time" readonly="true" type="text" style="width:400px;" value="{$data['info']['buy_time']}" /></td>
				    
				</tr>


				
				<tr>
				    <td>卖出价格</td>
				    <td><input name="sell_price"  id = "sell_price" type="text" style="width:400px;" value="" /></td>
				    
				</tr>

				<tr>
				    <td>卖出时间</td>
				    <td><input name="sell_time" readonly="true" type="text" style="width:400px;" value="{$data['info']['sell_time']}" /></td>
				    
				</tr>
				<tr>
				    <td>卖出数量</td>
				    <td><input name="sell_num"  id="sell_num" type="text" style="width:400px;" value=""   /></td>
				    
				</tr>				
				
					
				<tr>
				    <td>指导意见</td>
				    <td><textarea name="desc" rows="7"  style="width: 100%" shape="" coords="" href=""></textarea>
				    </td>
				  
				</tr> 

		    </table>

			<div class="form-group">
				
				<div style="margin-left:20px;">
					<input name="send" type="submit" value="提交" class="btn btn-primary" />
				</div>
				<div style="margin-left:20px;">

				</div>
			</div>
		</div>
	
	</form>	

	

{/block}
{block name="javascript"}

<script type="text/javascript">
	$('#exchange_id').change(function(){
		//alert("abc");
		var iframe_array = <?php echo  json_encode($variety);   ?>;
    	var checkValue=jQuery("#exchange_id").val();
    	//alert(checkValue);
    	$("#variety_id").empty();  
    	for (var i = 0; i <iframe_array.length ; i++) 
    	{
    		if(iframe_array[i]['exchange_id']==checkValue)
	    	{
	    		var opt = "<option value='"+iframe_array[i]['id']+"'>"+iframe_array[i]['name']+"</option>";
	    		jQuery("#variety_id").append(opt);
	    	}
	    }

	})



</script>
<script type="text/javascript">
	

$('#buy_price').blur(function(){

	//alert("test");
	var rang = {$data.info.rang};
	var buy_price=$('#buy_price').val();
	var sell_price = (buy_price*1.1).toFixed(2);
	if(buy_price=='')
	{
		alert('买入价格不能为空！');
	}
	$('#sell_price').val(sell_price);

	if(rang == 2)
	{
		var buy_num = Math.ceil(3000/buy_price);
		$('#buy_num').val(buy_num);
		$('#sell_num').val(buy_num);		
	}


	if(rang == 3)
	{
		var buy_num = Math.ceil(8000/buy_price);
		$('#buy_num').val(buy_num);
		$('#sell_num').val(buy_num);
	}

	if(rang == 4)
	{
		var buy_num = Math.ceil(15000/buy_price);
		$('#buy_num').val(buy_num);
		$('#sell_num').val(buy_num);
	}
	if(rang == 5)
	{
		var buy_num = Math.ceil(20000/buy_price);
		$('#buy_num').val(buy_num);
		$('#sell_num').val(buy_num);
	}

	if(rang == 6)
	{
		var buy_num = Math.ceil(20000/buy_price);
		$('#buy_num').val(buy_num);
		$('#sell_num').val(buy_num);
	}

	//输入价格

})

</script>
<script>
$(function(){	
	
	{if condition="$Request.param.id"}
			Oscshop.setValue("checked", {$data.info.checked|default=1});		
	{/if}
	
	$('.btn').click(function(){		
		
		if($('#pwd').val()==''){
			alert('密码必填');
			return false;
		}
		if($('#pwd').val().length<6){
			alert('密码长度必须大于等于6位！！');
			return false;
		}
	});		
});
</script>							
{/block}